//
// Created by ZLY on 2025/3/29.
//

#ifndef DECODETHREAD_H
#define DECODETHREAD_H
#include "thread.h"
#include <AVPacketQueue.h>
#include <AVFrameQueue.h>

extern "C" {
#include <libavcodec/avcodec.h>
}


class DecodeThread : public Thread {
public:
    DecodeThread(AVPacketQueue *packet_queue, AVFrameQueue *frame_queue);

    ~DecodeThread();

    int Init(AVCodecParameters *par);

    int Start();

    int Stop();

    void Run();

private:
    char err2str[255];
    AVCodecContext *codec_ctx_;
    AVPacketQueue *packet_queue_ = nullptr;
    AVFrameQueue *frame_queue_ = nullptr;
};


#endif //DECODETHREAD_H
